<?php

// application/forms/Tbladresse.php
class Application_Form_Tbladresse extends OMNZend_Form {    
    public function init() {
        // Set the method for the display form to POST
        $this->setMethod('post');

        //$companySiretElement = new Application_Form_Element_TblcompanySiretSelect('company_siret');
        $companyIdElement = new Application_Form_Element_TblcompanyIdSelect('company_id');

        // Add the Adresse element
        $adresse = new Zend_Form_Element_Text('adresse');
        $adresse->setLabel('Adresse');

        // Add the Code_postal element
        $codepostal = new Zend_Form_Element_Text('code_postal');
        $codepostal->setLabel('Code postal');

        // Add the Ville element
        $ville = new Zend_Form_Element_Text('ville');
        $ville->setLabel('Ville');

        // Add the Pays element
        $pays = new Zend_Form_Element_Text('pays');
        $pays->setLabel('Pays');
        
        // Add the submit button
        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setLabel('Add Company');

//        $this->addElements(array($companySiretElement, $adresse, $codepostal, $ville, $pays, $submit));
        $this->addElements(array($companyIdElement, $adresse, $codepostal, $ville, $pays, $submit));

        $this->clearDecorators();

        $this->addDecorator('FormElements')
                ->addDecorator('HtmlTag', array('tag' => '<ul>', 'class' => 'form'))
                ->addDecorator('Form');

        $this->setElementDecorators($this->_defaultDecorator);

        $this->getElement('company_id')->setDecorators($this->_inlineDecorator);
        $this->getElement('adresse')->setDecorators($this->_floatLeftDecorator);
        $this->getElement('code_postal')->setDecorators($this->_floatRightDecorator);
        $this->getElement('ville')->setDecorators($this->_floatLeftDecorator);
        $this->getElement('pays')->setDecorators($this->_floatRightDecorator);
        $this->getElement('submit')->setDecorators($this->_submitDecorator);
    }

}
